//
//  __Init.swift
//  eemall
//
//  Created by zhuxietong on 2019/1/21.
//  Copyright © 2019 tianrun. All rights reserved.
//

import Foundation
//import mosdks
import soapp

public struct MailInit {
    public static func initAction(){
        //添加点击跳转
        AppLink.routers.append(MallLink.self)
        AppLink.routers.append(GroupLink.self)
        
        
        //添加消息标记
        FastJPush.observers.append { (msg, type) in
            let msg = msg.any(nodes: "extras.msg","msg", default: NSMutableDictionary())
            let link = msg["link",""]
            let info = AppLink.paw(link: link)
            
            let type = GMsgType(rawValue: info.path) ?? .none        
            let ps = info.params.mutable_dictionary
            
            switch type {
            case .goods_order:
                type.msg.new(ID: ps["id",""])

            case .groups_order,.groups:
//                print("====III|11|\(ps["teamid",""])")
                GMsgType.groups.msg.new(ID: ps["teamid",""])

            default:
                break
            }
          
            
        }
    }
}
